﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace RFPL
{
    public partial class SeasonTable : Form
    {
        private int seasId = 0;

        public SeasonTable(int seasId)
        {
            InitializeComponent();
            this.seasId = seasId;
        }

        private void SeasonTable_Load(object sender, EventArgs e)
        {
            UpdateClubList();
        }

        private void UpdateClubList()
        {
            dgvClubs.Rows.Clear();

            SqlConnection conn = new SqlConnection();
            conn.ConnectionString = Global.connectionString;
            conn.Open();
            SqlCommand myCommand = conn.CreateCommand();
            myCommand.CommandType = CommandType.StoredProcedure;
            myCommand.CommandText = "[getSeasonTable]";
            myCommand.Parameters.Add("@id", SqlDbType.Int).Value = seasId;
            SqlDataReader dataReader = myCommand.ExecuteReader();
            while (dataReader.Read())
            {
                dgvClubs.Rows.Add(dataReader[0], dataReader[1], dataReader[2],
                                    dataReader[3], dataReader[4], dataReader[5],
                                    dataReader[6], dataReader[7], dataReader[8]);

            }
            dataReader.Close();
            conn.Close();
        }
    }
}
